If the PROGRAM token can only occur in this particular grammar production, then in the lexer you can simply flip a switch when you return PROGRAM that tells you to not ignore the next newline you see. After returning that newline flip that switch back off again.
Example:
Code:
program { do_newline = 1; return PROGRAM; }
\n { if (do_newline) { do_newline = 0; return '\n'; } }
These sorts of dependencies between the parser and the lexer are pretty common, and there is no single way of handling them. Basically, you are adding context-dependence to your grammar and it can be anywhere from relatively clean to horrible messy. The flex and bison user manuals have some examples of this sort of thing. But use them as inspiration, not templates for solving the problem.